﻿@model List<KRM.Core.VoucherCustomer>
@{
    ViewBag.Title = "Voucher Customers";
}
<div class="row-fluid" id="VoucherCustomer-MessageResult">
</div>
<div class="row-fluid" id="frViewCustomer">
    <div class="row-fluid" style="padding-bottom: 10px;">
        <div class="span3">
            @if(ViewBag.IsTargerCustomer)
                  {
                      <button type="button" class="btn btn-primary" onclick="PopupCenter('/voucher/SearchCustomer/?voucherid=@ViewBag.VoucherID', 1200, 650)">Add</button>
                  }
                  else{ <button type="button" class="btn" disabled="disabled">Add</button>}
        </div>
    </div>
    <div class="row-fluid" id="dttbVoucherCustomer">
        <table class="table table-hover table-bordered table-fix dataTable">
            <thead>
                <tr>
                    <th>CustomerID</th>
                    <th>Title</th>
                    <th>FirstName</th>
                    <th>LastName</th>
                    <th>EmailAddress</th>
                    <th>RedemptionDate</th>
                    <th>Delete</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model)
                {
                    <tr>
                        <td>@item.CustomerID</td>
                        <td>@item.tblCustomer.BillingAddress.Title</td>
                        <td>@item.tblCustomer.BillingAddress.Forename</td>
                        <td>@item.tblCustomer.BillingAddress.Surname</td>
                        <td>@item.tblCustomer.EmailAddress</td>
                        <td>@item.RedemptionDate</td>
                        <td style="text-align: center"> @if(ViewBag.IsTargerCustomer)
                                                        {
                                                            <a type="button"  onclick="DeleteVoucherCustomer(@item.CustomerVoucherID)">Delete</a>
                                                        }
                                                        else { <a type="button" disabled="disabled">Delete</a>}
                        </td>
                    </tr>
                }
            </tbody>
        </table>
    </div>
</div>
